package com.xuzhijie.pms.entity.vo;

import com.xuzhijie.pms.entity.Notice;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Data
@NoArgsConstructor
public class NoticeVo {
    private String id;
    private String title;
    private String status;
    private String range;
    private String descripe;
    private String content;
    private String creator;
    private LocalDateTime createTime;
    private LocalDateTime updateTime;
    private String tagColor;

    public NoticeVo(Notice notice){
        this.id = notice.getId();
        this.title = notice.getTitle();
        this.range = notice.getRanges();
        this.descripe = notice.getDescripe();
        this.content = notice.getContent();
        this.createTime = notice.getCreateTime();
        this.updateTime = notice.getUpdateTime();
        if (notice.getStatus() == 1){
            this.status = "未发布";
            this.tagColor = "info";
        }else if(notice.getStatus() == 2){
            this.status = "已发布";
            this.tagColor = "success";
        }else{
            this.status = "已删除";
            this.tagColor = "error";
        }
    }
}
